<%--
  Created by IntelliJ IDEA.
  User: RuoLi
  Date: 2023/2/12
  Time: 16:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>我的错题</title>
    <script src="<%=request.getContextPath()%>/js/index.js"></script>
    <!-- import CSS -->
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/index.css">
    <!-- axios -->
    <script src="<%=request.getContextPath()%>/js/axios.js"></script>
    <!-- import Vue before Element -->
    <script src="<%=request.getContextPath()%>/js/vue.js"></script>
    <!-- import JavaScript -->
    <script src="<%=request.getContextPath()%>/js/element-ui.js"></script>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/main_user.css"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/iconfont-ali.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.ttf">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.woff">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/iconfont.ttf">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/iconfont.woff">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/iconfont.woff2">
</head>
<body>
<div id="app">
    <el-page-header @back="goBack" content="我的错题"></el-page-header>
    <el-divider></el-divider>
    <el-row>
        <el-col></el-col>
        <el-table
                @row-click="handle"
                :data="topicLists"
                style="width: 100%;
                        margin-top: 20px">
            <el-table-column
                    prop="knowledge_point"
                    width="200"
                    label="知识点">
            </el-table-column>
            <el-table-column
                    prop="detailedTopicId"
                    width="120"
                    label="编号">
            </el-table-column>
            <el-table-column
                    prop="topic_title"
                    width="500"
                    label="题目">
            </el-table-column>
            <el-table-column
                    prop="topic_type"
                    label="题目类型">
            </el-table-column>
            <el-table-column
                    :prop="frequency"
                    label="题解次数">
            </el-table-column>
        </el-table>
    </el-row>
</div>
</body>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                topicLists: [],
            }
        },
        methods: {
            goBack() {
                window.location.href = "/online_website/user/main_index.jsp";
            },
            //获取用户错误的题库
            getUserErrorTopicInfo() {
                let userAccount = '<%=session.getAttribute("userAccount")%>';
                axios({
                    url: "/online_website/common/GetUserErrorTopicInfo",
                    method: "get",
                    contentType: "application/json",
                    params: {
                        "userAccount": userAccount,
                    },
                }).then((res) => {
                    this.topicLists = res.data;
                })
            },
            //表格点击事件
            handle(row, event, column) {
                let id = row.detailedTopicId;
                axios({
                    url: "/online_website/common/GoUserTopicPage",
                    method: "get",
                    contentType: "application/json",
                    params: {
                        "detailedTopicId": id,
                    },
                }).then((res) => {
                    window.location.href = "/online_website/user/info/userTopic.jsp"
                })
            },
        },
        created() {
            this.getUserErrorTopicInfo();
        }
    })
</script>
</html>
